package com.hmall.searchService.ThreadLocal;

import org.springframework.stereotype.Component;

@Component
public class LoginThreadLocal {
    private LoginThreadLocal(){};
    private static final ThreadLocal<Long> THREAD_LOCAL = new ThreadLocal<>();
    public static void setUserId(Long id){
        THREAD_LOCAL.set(id);
    }
    public static Long getUserId(){
        return  THREAD_LOCAL.get();
    }
    public static void remove(){
        THREAD_LOCAL.remove();
    }

}
